package com.sliding.controller;

import com.sliding.annotation.RateLimit;
import com.sliding.annotation.RateLimitByLua;
import com.sliding.enums.ModeType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    @RateLimit(window = 10, threshold = 2, mode = ModeType.IP)
    @GetMapping("/hello")
    public String hello() {
        return "hello world";
    }

    @RateLimitByLua(window = 10, threshold = 2, mode = ModeType.IP)
    @GetMapping("/helloByLua")
    public String helloByLua() {
        return "hello world";
    }
}
